package com.tsunami.auth.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tsunami.authority.dto.auth.ResourceQueryDTO;
import com.tsunami.authority.entity.auth.Resource;

import java.util.List;

/**
 * <p>
 * 资源表 Mapper 接口
 * </p>
 *
 * @author lx
 * @since 2021-09-23
 */
public interface ResourceMapper extends BaseMapper<Resource> {
    /**
     * 查询可用资源
     * @param userId
     * @return
     */
    List<String> findVisibleResource(Long userId);

    /**
     * 资源列表（分页）
     * @param buildPage
     * @param data
     * @return
     */
    Page<Resource> selectPageList(Page<Object> buildPage, Resource data);

    /**
     * 查询用户拥有的资源
     * @param resource
     * @return
     */
    List<Resource> findVisibleByResource(ResourceQueryDTO resource);

    /**
     * 资源ID查找菜单ID
     * @param resourceIdList
     * @return
     */
    List<Long> findMenuIdByResourceId(List<Long> resourceIdList);
}
